﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using ERP_RORZE_DLL.Product;
using ERP_RORZE_DLL.Product.DAO;
using ERP_RORZE_DLL.Product.database;
using ERP_RORZE_DLL.Product.Base;

namespace ERP_RORZE_PRODUCT.Product.Deadline
{
    public partial class ctrlDeadlineConfirm : DevExpress.XtraEditors.XtraUserControl
    {
        ClsDeadlineDAO clsDeadlineDAO = new ClsDeadlineDAO();
        DataTable dt;
        clsDeadlineCheckTable b = new clsDeadlineCheckTable();

        public ctrlDeadlineConfirm()
        {
            InitializeComponent();
        }
        void Re_load(object sender, EventArgs e)
        {
            dt = clsDeadlineDAO.GetAll();
            gridControl1.DataSource = dt;
            gridView1.BestFitColumns();
            //
            
            
        }

        private void btnReload_Click(object sender, EventArgs e)
        {
            Re_load(sender, e);
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            b.BOrderNo = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "BOrderNo").ToString();
            clsDeadlineDAO.Delete(b);
            Re_load(sender, e);
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            Frm_DeadlineCheckAdd frmAdd = new Frm_DeadlineCheckAdd();
            frmAdd.Reload += new EventHandler(Re_load);
            frmAdd.ShowDialog();
        }

        private void gridControl1_Load(object sender, EventArgs e)
        {
            Re_load(sender, e);
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            Re_load(sender, e);
        }

        private void btnAddNew_Click(object sender, EventArgs e)
        {
            btnAdd_Click(sender, e);
        }

        private void btnExport_Click(object sender, EventArgs e)
        {
            clsConstantsFuction.ExportToExcel(gridView1, 1, true);
        }


    }
}
